<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.14/vue.js"></script>
</head>
<body>
    <div id="app">
        <grand-father></grand-father>
    </div>
</body>
<script>
Vue.component('grand-father',{
    template: `<div>爷爷组件
        <father :money="money" @pay="onPay"></father>    
    </div>`,
    data() {
        return {
            money: 1000
        }
    },
    methods: {
        onPay(num){
            this.money -= num
        }
    },
})  
Vue.component('father',{
    props: ['money'],
    template: `<div>爸爸组件
        <son :money="money" @pay="$emit('pay', $event)"></son>
    </div>`
})  
Vue.component('son',{
    props: ['money'],
    template: `<div>孙子-{{money}}--<button @click="$emit('pay', 100)">pay</button></button></div>`
})  

let vm = new Vue({
    el: '#app',
    data(){
        return {
        }
    }
})
</script>
</html>